package com.situ.helloandroid;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class TestActivity extends AppCompatActivity {
    private Button mBtn;
    private EditText mEtNum;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);
        mBtn = (Button) findViewById(R.id.btn);
        mEtNum = (EditText) findViewById(R.id.et_num);

        mBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String num = mEtNum.getText().toString();// "3.14"
                double d = Double.parseDouble(num);
                System.out.println(d + 1);
            }
        });
    }
}
